package cn.shyouchi.wuguanjia.android.api.matter;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.shyouchi.wuguanjia.android.api.ClientProvider;
import cn.shyouchi.wuguanjia.android.api.UserStorageProvider;
import cn.shyouchi.wuguanjia.android.components.storage.UserStorage;
import cn.shyouchi.wuguanjia.android.model.BaseRequestResult;
import cn.shyouchi.wuguanjia.android.model.BaseResult;
import cn.shyouchi.wuguanjia.android.ui.home.security.thread.message.birthday.BirthdayNotice;
import cn.shyouchi.wuguanjia.android.ui.home.security.thread.message.casual.CasualNotice;
import cn.shyouchi.wuguanjia.android.ui.home.security.thread.message.matter.MatterBirthday;
import cn.shyouchi.wuguanjia.android.ui.home.security.thread.message.matter.MatterMeet;
import cn.shyouchi.wuguanjia.android.ui.home.security.thread.message.matter.MatterNotice;
import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by Eenie on 2017/3/20 at 13:45
 * Email: 472279981@qq.com
 * Des:
 */

public class MatterApi {

    private MatterService mService;

    private UserStorage mUserStorage;


    public MatterApi() {
        mUserStorage = UserStorageProvider.Default();
        Retrofit retrofit = ClientProvider.getDefaultClient().getRetrofit(mUserStorage);
        mService = retrofit.create(MatterService.class);
    }

    public Observable<BaseRequestResult<List<MatterNotice>>> getMatters() {
        return mService.getMatters();
    }
    public Observable<BaseRequestResult<List<BirthdayNotice>>> getBirthdayList() {
        return mService.getBirthdayList();
    }
    public Observable<BaseRequestResult<List<CasualNotice>>> getErrorList() {
        return mService.getErrorList();
    }

    public Observable<BaseRequestResult<MatterMeet>> getMeetDetail(String id) {

        return mService.getMeetDetail(id);
    }
    public Observable<BaseRequestResult<List<CasualNotice>>> getErrorDetail() {

        return mService.getErrorDetail();
    }
    public Observable<BaseRequestResult<MatterBirthday>> getBirthdayDetail(String id) {

        return mService.getBirthdayDetail(id);
    }

    /**
     * 审核会议
     * @param id
     * @param advice
     * @param reason
     * @return
     */
    public Observable<BaseResult> AuditMeet(String id, int advice, String reason) {
        Map<String, Object> params = new HashMap<>();
        params.put("checkstatus", advice);
        params.put("check_feedback", reason);
        params.put("id", id);
        return mService.AuditMeet(params);
    }

    public Observable<BaseResult> sendGift(String id, int advice, String reason) {
        Map<String, Object> params = new HashMap<>();
        params.put("cake", advice);
        params.put("greetings", reason);
        params.put("id", id);
        return mService.sendGift(params);
    }




}
